﻿using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SystemServices
{
    class SystemServiceController
    {
        private readonly ILogger logger;

        public SystemServiceController(ILogger<SystemServiceController> logger)
        {
            this.logger = logger;
        }

        public void Test()
        {
            logger.LogDebug("开始执行FTP同步");
            logger.LogDebug("连接FTP成功");
            logger.LogWarning("查找文件失败，重试第一次");
            logger.LogWarning("查找文件失败，重试第二次");
            logger.LogError("查找文件最终失败");
            logger.LogCritical("文件异常");

            var user = new User()
            {
                Name = "admin",
                Email = "abc@qq.com"
            };
            logger.LogInformation("注册用户{@person}", user);
        }
    }

    class User
    {
        public string Name { get; set; }
        public string Email { get; internal set; }
    }
}
